﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Adams.Public.Api.Controllers.Web
{
    [EnsureHttps]
    public class LayoutController : Controller
    {
        public ActionResult LayoutPageLoad(Adams.Public.DataTransfer.Web.Layout.LayoutPageLoadInput input)
        {
            var data = Shared.ObjectHelper.CopyObject<DataTransfer.Web.Layout.LayoutPageLoadInputBusiness>(input);

            data.MemberID = Api.Security.GetMemberIDFromToken(input.Token);

            var model = DataAccess.Web.Layout.LayoutPageLoad(data);

            model.GregorianDate = DateTime.Now.ToString("MMMM dd, yyyy");
            model.HijriDate = Adams.Shared.CalendarHelper.GetHijriDate(DateTime.Now.AddDays(-1));

            return new JsonXmlResult(model);
        }
    }
}
